  <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@include file="/resource/common/taglib.jspf"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>${SESSION_COMPANY}-WebNews</title>
<%@include file="/resource/common/jquery.jspf"%>

<%@include file="/resource/common/bootstrap.jspf"%>
<%@include file="/resource/common/ztree.jspf"%>
<script type="text/javascript" src="${ctxStatic }/js/system/layerParentFn.js"></script>
<script type="text/javascript">
	var PATH = "${ctx}";
	function addLayerOpen(id,titles,edit){
		if(edit){
			titles = id >0?"编辑："+titles:"新增：";
			layerParentFn.layerOpenModalDialog(titles,"addWebNews.do?id="+id,1065,620,"inputForm","saveWebNewsJson.do");
		}else{
			titles = "浏览:"+titles;
			layerParentFn.layerOpenBrowseModalDialog(titles,"addWebNews.do?id="+id,1065,620);
		}
	}
	
</script>

</head>
<body>
	<div id="body-wrapper">
		<div id="main-content">
			<div class="clear"></div>
			<!-- End .content-box-header -->
			<div class="content-box-content">
				<div class="search-box">
					<shiro:hasPermission name="webNews:SYS_ADD">
						<a href="javascript:void(0)" onclick="addLayerOpen(0,'',true);" class="btn btn-sm btn-primary" ><i class="fa fa-plus"></i>&nbsp;&nbsp;新增</a>
					</shiro:hasPermission>
					<hr style="margin-top: 10px; margin-bottom: 10px;">
					<shiro:hasPermission name="webNews:SYS_SEARCH">
						<form action="webNewsList.do" method="post" id="fromsearch" class="form-inline">
							<div class="form-group">
								<div class="input-group">
									<div class="input-group-addon">城市</div>
									<select name="cityId" id="cityId">
										<option value="" <c:if test="${entity.cityId=='' }">selected="selected"</c:if>>所有</option>
										<c:forEach var="item" items="${city_list }" varStatus="s">
											<option value="${item.id}" <c:if test="${item.id == entity.cityId }"> selected="selected"</c:if>> ${item.chineseName } </option>
										</c:forEach>
									</select>
								</div>
							</div>
							<div class="form-group">
								<div class="input-group">
									<div class="input-group-addon">标题</div>
									<input type="text" class="form-control" value="${entity.title}" name="title" id="title" placeholder="新闻标题" />
								</div>
							</div>
							
							<div class="form-group">
								<div class="input-group">
									<div class="input-group-addon">类别</div>
									<input type="hidden" id="type" name="type" value="${entity.type}" /> 
									<input type="text" class="form-control input-sm"
												onclick="showMenu('menuChannel','treeChannelDemo','categoryName','type')" value="${entity.categoryName}"  name="categoryName" id="categoryName"  placeholder="新闻类别"/>
								</div>
							</div>
							
							<div class="form-group">
								<div class="input-group">
									<div class="input-group-addon">是否推荐</div>
									<select name="recommend" id="recommend" class="form-control input-sm">
										<option value="" <c:if test="${entity.recommend=='' }">selected="selected"</c:if>>所有</option>
										<option value="true" <c:if test="${entity.recommend==true }">selected="selected"</c:if>>是</option>
										<option value="false" <c:if test="${entity.recommend==false }">selected="selected"</c:if>>否</option>
									</select>
								</div>
							</div>
							<div class="form-group">
								<div class="input-group">
									<div class="input-group-addon">是否开启</div>
									<select name="status" id="status" class="form-control input-sm">
										<option value="" <c:if test="${entity.status=='' }">selected="selected"</c:if>>所有</option>
										<option value="true" <c:if test="${entity.status==true }">selected="selected"</c:if>>是</option>
										<option value="false" <c:if test="${entity.status==false }">selected="selected"</c:if>>否</option>
									</select>
								</div>
							</div>
							
							<button type="submit"  class="btn btn-sm btn-primary"> <i class="fa fa-search"></i>查询 </button>
						</form>
					</shiro:hasPermission>
				</div>
				<div class="tab-content default-tab" id="tab1">
					<table class="table table-bordered table-hover"  style="table-layout:fixed;">
						<thead>
							<tr>
								<th class="w40 text-center">编号</th>
								<th class="w90 text-center">城市</th>
								<th class="w90 text-center">新闻类别</th> 
								<th class="text-center">新闻标题</th> 
								<th class="w60 text-center">图片</th>
								<th class="w40 text-center">排序</th> 
								<th class="w60 text-center">浏览量</th>
								<th class="w90 text-center">是否推荐</th>
								<th class="w90 text-center">是否开启</th>
								<th class="w150 text-center">创建时间</th>
								<th class="w210 text-center">操作</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach var="entity" items="${pageBean.list}" varStatus="abc">
							<tr id="tr_${entity.id }">
								<td class="text-center">${startRow+abc.count}</td> 
								<td class="text-center">${entity.cityName}</td>
								<td class="text-center">${entity.categoryName}</td>
								<td style="word-break:keep-all;white-space:nowrap; overflow:hidden;text-overflow:ellipsis;" >${entity.title}</td>
								<td class="text-center">
									<c:if test="${not empty entity.photo}">
									    <c:choose> 
									          <c:when test="${fn:contains(entity.photo,'http')}">    
									              <img src="${entity.photo }" style="max-width: 90px; max-height: 30px;"/>
									          </c:when> 
									          <c:otherwise>    
									               <img src="http://www.hminvestment.com/static/upfile/${entity.photo }" style="max-width: 90px; max-height: 30px;"/>
									          </c:otherwise> 
									    </c:choose> 
									</c:if>
								</td> 
								<td class="text-center">${entity.sort}</td> 
								<td class="text-center">${entity.pageView}</td> 
								<td class="text-center">${entity.recommend?"是":"否"}</td> 
								<td class="text-center">${entity.status?"是":"否"}</td> 
								<td class="text-center"><fmt:formatDate value="${entity.createTime}" pattern="yyyy-MM-dd HH:mm:ss" /></td> 
								<td class="text-center">
									<shiro:hasPermission name="webNews:SYS_BROWSE">
										<a href="javascript:void(0);" onclick="addLayerOpen(${entity.id},'${entity.title}',false);" title="浏览" class="btn btn-xs btn-info"><i class="fa fa-eye"></i>&nbsp;浏览</a> 
									</shiro:hasPermission>
									<shiro:hasPermission name="webNews:SYS_EDIT">
										<a href="javascript:void(0);" onclick="addLayerOpen(${entity.id},'',true);" class="btn btn-xs btn-primary"><i class="fa fa-edit"></i>&nbsp;编辑</a>
									</shiro:hasPermission> 
									<shiro:hasPermission name="webNews:SYS_DELETE">
										<a href="javascript:void(0);" onclick="layerParentFn.listRowRemoveDeleteByID(${entity.id },'deleteWebNews.do');" class="btn btn-xs btn-danger"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
									</shiro:hasPermission>
								</td>
							</tr>
							</c:forEach>
						</tbody>
						<tfoot>
							<tr>
								<td colspan="10">
									<div class="bulk-actions align-right"></div>
									<div class="paginationstyle">
										<page:pageboot url="webNewsList.do?cityId=${entity.cityId}&title=${entity.title}&type=${entity.type}&recommend=${entity.recommend}&status=${entity.status}&" tagnum="2" pageBean="${pageBean}" />
									</div>
									<div class="clear"></div>
								</td>
							</tr>
						</tfoot>
					</table>
				</div>
				<!-- End #tab2 -->
			</div>
			<div id="menuChannel" class="menuContent" style="display:none; position: absolute;">
					<ul id="treeChannelDemo" class="ztree" style="margin-top:0; width:180px; height: 300px;"></ul>
				</div>
			<!-- End .content-box-content -->
		</div>
		<!-- End #main-content -->
	</div>
	<script type="text/javascript">

$(document).ready(function() {

	$("treeChannelDemo").ztreeMenuUtils({
		url : "webNewesType/tree.do",
		rootMenu	:	"menuChannel",
		rootNode : "treeChannelDemo",
		checkNodes : "#type",
		checkNodeName	:	"#categoryName",
		checkParent	:	false,
		checkMore	: false,
		checkBox	: false,
		checkSpilt	: ",",
	});
});

</script>
</body>
<!-- Download From www.exet.tk-->
</html>
